<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>访客跟进</title>
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/homePage.css">
    <link rel="stylesheet" href="css/flexible.css">
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/flexible.js"></script>
    <script src="js/vue.js"></script>
    <script src="js/MD5.js"></script>
    <script src="js/qs.js"></script>
    <script src="js/axios.js"></script>
</head>
<body>
<div class="container_box">
    <div class="Information_entry">
        <label class="lf">跟进方式</label>
        <div class="rf message padding14">
            <select v-model="from.Ftype">
                <option v-for="item in Ftype" :value="item.id">
                    {{item.name}}
                </option>
            </select>
        </div>
    </div>
    <div class="remark">
        <label class="lf">跟进内容</label>
        <div class="lf width75">
            <textarea v-model="from.Info" rows="6" placeholder="请输入跟进内容"></textarea>
        </div>
    </div>
    <div class="save">
        <button type="button">保存</button>
    </div>
</div>
</body>
<script>
new Vue({
    el: '#app',
    data: {
        from:{
            Uid:'1',
            Ftype:"0",
            Info:""
        },
        Ftype:[
            {
                name:'电话',
                id:'0'
            },
            {
                name:'微信',
                id:'1'
            },
            {
                name:'QQ',
                id:'2'
            },
            {
                name:'短信',
                id:'3'
            },
            {
                name:'面谈',
                id:'4'
            },
        ],
    },
    created(){
        this.getList()
    },
    methods:{
        getRadioVal (event) { 
            let radioVal = event.target.value;  
            console.log(radioVal);
            this.from.Sex=radioVal
        },
        //获取信息
        getList(){
            getVs()
            axios.get('/mobileapi/adviser/customer.php?act=type_from').then(data =>{
                console.log(data.data)
                let { msg, code,user} = data.data
                    if (code !== 200) {
                        _this.$message({
                            message: msg,
                            type: 'error'
                        });
                    } else {
                        data=data.data
                        this.cfrom=data.data.cfrom
                        this.Usertype=data.data.Usertype
                    }
                }).catch(function (error) { 
                    console.log(error); 
            });
        },
        save(){
            this.from.Level=this.$refs.Level.value
            console.log(this.from)
            let from =JSON.stringify(this.from)
            let sign=md5(from)
            let params={
                from:from,
                sign:sign
            }
            getVs()
            axios.post('/mobileapi/adviser/customer.php?act=addgo',
            Qs.stringify(params)).then(function(response){
                console.log(response.data)
                let { msg, code} = response.data
                    if (code !== 200) {
                        _this.$message({
                        message: msg,
                        type: 'error'
                        });
                    } else {
                        let type="1"
                        let state='1'
                        window.location.href='myMember.html?type='+type+'&state='+state+''
                    }
                    
                }).catch(function (error) { 
                    console.log(error); 
            });
        }
    }
})
</script>
</html>